<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex sanskritQingliu_flex_0"
        :style="{height:(140+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub sanskritQingliu_fd0_0'>
          <view class='flex flex-wrap align-center sanskritQingliu_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='sanskritQingliu_fd0_0_c1_c0'>{{$t('灵岩妙音')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end sanskritQingliu_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/fyql/searchPage/searchPage`">
            <image class='sanskritQingliu_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"19.png"'></image>
          </view>
        </view>

      </view>
      <view :style="{height: (140+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view>
          <benben-flex-tabs class-name='sanskritQingliu_benbenTabsfd1_0' v-model="tabls" ref="benben_tabsfd1_0"
            select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false' :open-sticky='false' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd1_0" @change="getBuddhistFunc()">

            <scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left.sync="tabsInfofd1_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd1_0-content">
                <view id="benben_tabsfd1_0-title" class="benben-tabs-title flex align-center flex ">
                  <view
                    :class="{ 'checkTitlefd1_0': tabls == '1', 'flex flex-wrap align-center sanskritQingliu_titlefd1_0_c3': true }"
                    @tap="tabls = '1'" :id="`benben_tabsfd1_0-title-item-${'1'}`">

                    <text>{{$t('佛经')}}</text>

                  </view>
                  <view
                    :class="{ 'checkTitlefd1_0': tabls == '2', 'flex flex-wrap align-center sanskritQingliu_titlefd1_0_c3': true }"
                    @tap="tabls = '2'" :id="`benben_tabsfd1_0-title-item-${'2'}`">

                    <text>{{$t('音频')}}</text>

                  </view>
                  <view
                    :class="{ 'checkTitlefd1_0': tabls == '3', 'flex flex-wrap align-center sanskritQingliu_titlefd1_0_c3': true }"
                    @tap="tabls = '3'" :id="`benben_tabsfd1_0-title-item-${'3'}`">

                    <text>{{$t('视频')}}</text>

                  </view>
                </view>
                <view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
                  id="benben_tabsfd1_0-line"
                  class="benben-tabs-line flex benben-flex-tabs-line sanskritQingliu_linefd1_0"></view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view>
      <!-- 音频 -->
      <view class="container-box" v-if="tabls==2">
        <view class="flex align-center container-bij">
          <view class=" container-item" :class="audiobigId==item.aid ? 'active' : ''" @click.stop="choosebij('1',item)"
            v-for="(item,index) in audiobijList" :key="index">
            {{item.name}}
          </view>
        </view>
        <scroll-view class="flex justify-around  container" scroll-x="true">
          <view @click.stop="choosecate('1',item)" class=" container-item" :class="audioid==item.aid ? 'active' : ''"
            v-for="(item,index) in audioList" :key="index">
            <image class="icons" :src="item.img" mode="aspectFill"></image>
            <view style="text-align: center;">
              {{item.fenleimingcheng}}
            </view>

          </view>
        </scroll-view>
        <!-- <view class="flex justify-around container">

          <view class="flex flex-direction justify-between align-center container-item"
            @click.stop="choosecate('1',item)" :class="audioid==item.aid ? 'active' : ''"
            v-for="(item,index) in audioList" :key="index">
            <image class="icons" :src="item.img" mode="aspectFill"></image>
            <view>
              {{item.fenleimingcheng}}
            </view>

          </view>
        </view> -->
      </view>
      <!-- 视频 -->
      <view class="container-box" v-if="tabls==3">
        <view class="flex  justify-center container-bij">
          <view class=" container-item" :class="videobigId==item.aid ? 'active' : ''" @click.stop="choosebij('2',item)"
            v-for="(item,index) in videobijList" :key="index">
            {{item.name}}
          </view>
        </view>
        <scroll-view class="flex justify-around  container" scroll-x="true">
          <view @click.stop="choosecate('2',item)" class="container-item" :class="videoid==item.aid ? 'active' : ''"
            v-for="(item,index) in videoList" :key="index">
            <image class="icons" :src="item.img" mode="aspectFill"></image>
            <view style="text-align: center;">{{item.fenleimingcheng}}</view>

          </view>
        </scroll-view>

      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-stretch benben-flex-layout sanskritQingliu_flex_2" v-if=" tabls=='1'">
        <template v-for='(item,key0) in scripturesList'>
          <view class='flex flex-direction flex-wrap align-start sanskritQingliu_fd2_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo"
            :data-url="`/pages/fyql/introductionScriptures/introductionScriptures?id=${item.aid}`" :key='key0'>
            <view class='flex flex-wrap align-center'>
              <image class='sanskritQingliu_fd2_0_c0_c0' mode="aspectFill" :src='item.img'></image>
            </view>
            <view class='text-cut sanskritQingliu_fd2_0_c1'>{{item.title}}</view>
            <view class='flex flex-wrap align-center sanskritQingliu_fd2_0_c2'>
              <text class='sanskritQingliu_fd2_0_c2_c0'>{{item.num}}</text>
              <text class='sanskritQingliu_fd2_0_c2_c0'>{{$t('人修持')}}</text>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center sanskritQingliu_flex_3" v-if=" tabls=='2'">
        <template v-for='(item,key0) in frequencyList'>
          <view class='flex flex-direction flex-wrap align-start sanskritQingliu_fd3_0' :key='key0'
            @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/fyql/audio/audio?id=${item.aid}`">
            <view class='flex flex-wrap align-center sanskritQingliu_fd3_0_c0'>
              <image class='sanskritQingliu_fd3_0_c0_c0' mode="aspectFill" :src='item.img'></image>
              <view class='flex flex-wrap align-center sanskritQingliu_fd3_0_c0_c1'>
                <image class='sanskritQingliu_fd3_0_c0_c1_c0' mode="aspectFill" :src='STATIC_URL+"61.png"'></image>
                <text class='sanskritQingliu_fd3_0_c0_c1_c1'>{{item.num}}</text>
              </view>
            </view>
            <view class='text-cut-3 sanskritQingliu_fd3_0_c1'>{{item.title}}</view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center sanskritQingliu_flex_4" v-if=" tabls=='3'">
        <template v-for='(item,key0) in tutorialList'>
          <view class='flex flex-direction flex-wrap align-start sanskritQingliu_fd4_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/fyql/tutorialDetails/tutorialDetails?id=${item.aid}&type=1`"
            :key='key0'>
            <view class='flex flex-wrap align-center sanskritQingliu_fd4_0_c0'>
              <image class='sanskritQingliu_fd4_0_c0_c0' mode="aspectFill" :src='item.img'></image>
              <view class='flex flex-wrap align-center sanskritQingliu_fd4_0_c0_c1'>
                <image class='sanskritQingliu_fd4_0_c0_c1_c0' mode="aspectFill" :src='STATIC_URL+"61.png"'></image>
                <text class='sanskritQingliu_fd4_0_c0_c1_c1'>{{item.num}}</text>
              </view>
            </view>
            <view class='text-cut-3 sanskritQingliu_fd4_0_c1'>{{item.title}}</view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "tabsInfofd1_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "tabls": "1",
        "scripturesList": [],
        "frequencyList": [],
        "tutorialList": [],
        audioid: 0,
        audioList: [],
        audiobijList: [{
            name: global.i18n.t('梵音清流'),
            aid: '6'
          },
          {
            name: global.i18n.t('法语清凉'),
            aid: '7'
          }
        ],
        audiobigId: '6',


        videoid: '',
        videoList: [],
        videobijList: [{
            name: global.i18n.t('梵音清流'),
            aid: '4'
          },
          {
            name: global.i18n.t('法语清凉'),
            aid: '1'
          }
        ],
        videobigId: '4',
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getCatey()
      this.getCates()
      this.getBuddhistFunc()

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      uni.setTabBarItem({
        index: 0,
        text: this.$t('首页'),
        iconPath: '/static/tab/tab_diy0.png',
        selectedIconPath: '/static/tab/tab_diy0_active.png'
      })
      uni.setTabBarItem({
        index: 1,
        text: this.$t('灵岩妙音'),
        iconPath: '/static/tab/tab_diy1.png',
        selectedIconPath: '/static/tab/tab_diy1_active.png'
      })
      uni.setTabBarItem({
        index: 2,
        text: this.$t('功德'),
        iconPath: '/static/tab/tab_diy2.png',
        selectedIconPath: '/static/tab/tab_diy2_active.png'
      })
      uni.setTabBarItem({
        index: 3,
        text: this.$t('我的'),
        iconPath: '/static/tab/tab_diy3.png',
        selectedIconPath: '/static/tab/tab_diy3_active.png'
      })
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getBuddhistFunc()
      // this.getFrequencyFunc()
      // this.getTutorialFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      chooseCate(item) {
        this.cateId = item.aid
        this.getActivityFunc()
      },
      choosebij(type, item) {
        if (type == 1) { //音频
          this.audiobigId = item.aid
          this.audioid = this.audioList[0].aid
          this.getCatey()
        } else {
          this.videobigId = item.aid
          this.videoid = this.audioList[0].aid

          this.getCates()
        }
      },
      choosecate(type, item) {
        if (type == 1) { //音频
          this.audioid = item.aid

        } else {
          this.videoid = item.aid
        }
        this.getBuddhistFunc()
      },
      getCatey() {
        // 音频
        this.$api.post(global.apiUrls.post67106e3f893f9, {
          type: this.audiobigId
        }).then(res => {
          if (res.data.code == 1) {
            this.audioList = res.data.data
            this.audioid = this.audioList[0].aid
            // this.audioList.unshift({
            //   aid: 0,
            //   fenleileixing: '0',
            //   fenleimingcheng: global.i18n.t('全部')
            // })

            // this.getBuddhistFunc()
          }
        })
      },
      getCates() {
        // 视频
        this.$api.post(global.apiUrls.post67106e3f893f9, {
          type: this.videobigId
        }).then(res => {
          if (res.data.code == 1) {
            this.videoList = res.data.data
            this.videoid = this.videoList[0].aid
            // this.videoList.unshift({
            //   aid: 0,
            //   fenleileixing: '0',
            //   fenleimingcheng: global.i18n.t('全部')
            // })
            // this.getBuddhistFunc()

          }
        })
      },
      //请求数据列表
      getDataFunc() {
        let datas = {}
        if (this.tabls == '1') {
          this.getBuddhistFunc()
          return
        }
        if (this.tabls == '2') {
          datas.cateid = this.audioid
          this.getFrequencyFunc()
          return
        }
        if (this.tabls == '3') {
          datas.cateid = this.videoid
          this.getTutorialFunc()
          return
        }
      },
      //获取佛经
      getBuddhistFunc() {
        let urls = ''
        let datas = {}
        if (this.tabls == '1') {
          urls = global.apiUrls.post657158b834ff4
        }
        if (this.tabls == '2') {
          datas.cateid = this.audioid
          urls = global.apiUrls.post65715b963ed98
        }
        if (this.tabls == '3') {
          datas.cateid = this.videoid
          urls = global.apiUrls.post65715ccc124cd
        }
        this.minixPagingListsApi = urls;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = datas
        this.listData = [];
        if (this.tabls == 1) {
          this.scripturesList = this.listData;
        }
        if (this.tabls == 2) {
          this.frequencyList = this.listData;
        }
        if (this.tabls == 3) {
          this.tutorialList = this.listData;
        }
        this.pagingListToggle();
        console.log('’ee', this.scripturesList)

      },
      // //获取音频
      // getFrequencyFunc() {
      //   this.minixPagingListsApi = global.apiUrls.post65715b963ed98;
      //   this.pageingListApiMethod = 'post';
      //   this.allowOnloadGetList = false;
      //   this.pagingListPostDataContent = {
      //     cateid: this.audioid
      //   }
      //   this.listData = [];
      //   this.frequencyList = this.listData;
      //   this.pagingListToggle();

      // },
      // //获取佛学教程
      // getTutorialFunc() {
      //   this.minixPagingListsApi = global.apiUrls.post65715ccc124cd;
      //   this.pageingListApiMethod = 'post';
      //   this.allowOnloadGetList = false;
      //   this.pagingListPostDataContent = {
      //     cateid: this.videoid
      //   }
      //   this.listData = [];
      //   this.tutorialList = this.listData;
      //   this.pagingListToggle();

      // },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .icons {
    width: 80rpx;
    height: 80rpx;
    display: block;
    border-radius: 16%;
    margin: 0 auto;
  }

  .container-box {
    width: 750rpx;
    height: auto;
    // padding: 16rpx 0;
    background: rgba(247, 243, 237, 1);

    .container-bij {
      .container-item {
        width: 50%;
        text-align: center;
        height: 70rpx;
        line-height: 70rpx;

        &.active {
          color: #912f22;
          font-weight: 600;
        }
      }
    }

    .container {
      width: 702rpx;
      margin: 0 auto;
      white-space: nowrap;
      // overflow-x: scroll;
      min-height: 80rpx;

      .container-item {
        margin-right: 24rpx;
        display: inline-block;
        // padding-right: 24rpx;

        // white-space: nowrap;

        &.active {
          color: #912f22;
          font-weight: 600;
        }
      }
    }
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(247, 243, 237, 1);
    background-size: 100% auto;
  }

  .sanskritQingliu_flex_0 {
    background: url(image-path('18.png')) no-repeat;
    width: 750rpx;
    height: 140rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% 100%;
    border-radius: 0rpx 0rpx 56rpx 56rpx;
  }

  .sanskritQingliu_fd0_0_c2_c0 {
    width: 48rpx;
    height: 48rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sanskritQingliu_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
    line-height: 50rpx;
  }

  .sanskritQingliu_fd0_0_c0 {
    width: 120rpx;
  }

  .sanskritQingliu_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .sanskritQingliu_titlefd1_0_c3 {
    margin: 0rpx 100rpx 0rpx 0rpx;
  }

  .sanskritQingliu_linefd1_0 {
    background: rgba(145, 47, 34, 1);
    width: 16rpx;
    height: 16rpx;
    top: 72rpx;
    background-size: 100% auto !important;
    border-radius: 100rpx;
  }

  .checkTitlefd1_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #912F22 !important;
  }

  ::v-deep .sanskritQingliu_benbenTabsfd1_0 {
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    padding-left: 32rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #666666;
  }

  .sanskritQingliu_flex_2 {
    padding: 32rpx 7rpx 0rpx 32rpx;
  }

  .sanskritQingliu_fd2_0_c2_c0 {
    color: #999999;
    font-size: 22rpx;
    font-weight: 400;
    line-height: 22rpx;
  }

  .sanskritQingliu_fd2_0_c2 {
    margin: 16rpx 0rpx 0rpx 20rpx;
  }

  .sanskritQingliu_fd2_0_c1 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 32rpx;
    width: 200rpx;
    margin: 20rpx 0rpx 0rpx 20rpx;
  }

  .sanskritQingliu_fd2_0_c0_c0 {
    width: 212rpx;
    height: 260rpx;
    border-radius: 40rpx;
  }

  .sanskritQingliu_fd2_0 {
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
    border-radius: 40rpx;
    padding: 0rpx 0rpx 20rpx 0rpx;
    width: 212rpx;
    margin: 0rpx 25rpx 20rpx 0rpx;
  }

  .sanskritQingliu_flex_3 {
    padding: 32rpx 7rpx 0rpx 32rpx;
  }

  .sanskritQingliu_fd3_0_c1 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    width: 89%;
    line-height: 32rpx;
    margin: 20rpx 0rpx 0rpx 20rpx;
  }

  .sanskritQingliu_fd3_0_c0_c1_c1 {
    color: #FFFFFF;
    font-size: 24rpx;
    font-weight: 700;
    line-height: 35rpx;
  }

  .sanskritQingliu_fd3_0_c0_c1_c0 {
    width: 28rpx;
    height: 28rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sanskritQingliu_fd3_0_c0_c1 {
    background: rgba(51, 51, 51, 0.8);
    position: absolute;
    padding: 6rpx 12rpx 6rpx 12rpx;
    border-radius: 24rpx;
    background-size: 100% auto;
    bottom: 10rpx;
    right: 10rpx;
  }

  .sanskritQingliu_fd3_0_c0_c0 {
    width: 212rpx;
    height: 260rpx;
    border-radius: 40rpx;
  }

  .sanskritQingliu_fd3_0_c0 {
    position: relative;
  }

  .sanskritQingliu_fd3_0 {
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
    border-radius: 40rpx;
    padding: 0rpx 0rpx 20rpx 0rpx;
    width: 212rpx;
    margin: 0rpx 25rpx 20rpx 0rpx;
  }

  .sanskritQingliu_flex_4 {
    padding: 32rpx 7rpx 0rpx 32rpx;
  }

  .sanskritQingliu_fd4_0_c1 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 32rpx;
    width: 89%;
    margin: 20rpx 0rpx 0rpx 20rpx;
  }

  .sanskritQingliu_fd4_0_c0_c1_c1 {
    color: #FFFFFF;
    font-size: 24rpx;
    font-weight: 700;
    line-height: 35rpx;
  }

  .sanskritQingliu_fd4_0_c0_c1_c0 {
    width: 28rpx;
    height: 28rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sanskritQingliu_fd4_0_c0_c1 {
    background: rgba(51, 51, 51, 0.8);
    position: absolute;
    padding: 6rpx 12rpx 6rpx 12rpx;
    border-radius: 24rpx;
    background-size: 100% auto;
    bottom: 10rpx;
    right: 10rpx;
  }

  .sanskritQingliu_fd4_0_c0_c0 {
    width: 212rpx;
    height: 260rpx;
    border-radius: 40rpx;
  }

  .sanskritQingliu_fd4_0_c0 {
    position: relative;
  }

  .sanskritQingliu_fd4_0 {
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
    border-radius: 40rpx;
    padding: 0rpx 0rpx 20rpx 0rpx;
    width: 212rpx;
    margin: 0rpx 25rpx 20rpx 0rpx;
  }
</style>
